package ast;

import java.util.ArrayList;

public class Principal extends Term implements CstPr {

	private String name;
	
	private ArrayList<Principal> actsFor;
	
	public Principal(String nm)
	{
		name = nm;
		actsFor = new ArrayList<Principal>();
	}
	
	public String getName()
	{
		return name;
	}
	
	public ArrayList<Principal> getActsFor()
	{
		return actsFor;
	}
	
	public boolean addActFor(Principal q) 
	{
		boolean contains = false;
		for (Principal r : actsFor) {
			if (q.getName().equals(r.getName())) {
				contains = true;
				break;
			}
		}
		if (!contains) {
			actsFor.add(q);
		}
		
		return !contains;
	}
	
	public String toString()
	{
		return name;
	}
}
